<?php

set_time_limit(1000);

require dirname(__FILE__).'/../config.php';

$pdo = new PDO('sqlite:'.SQLITE_PATH);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

var_dump($pdo->query("SELECT name FROM sqlite_master 
WHERE type IN ('table','view') AND name NOT LIKE 'sqlite_%'
UNION ALL 
SELECT name FROM sqlite_temp_master 
WHERE type IN ('table','view') 
ORDER BY 1")->fetchAll(PDO::FETCH_ASSOC));

$pdo->query("ALTER TABLE wp_types_temp RENAME TO wp_types;");
$pdo->query("VACUUM");


var_dump($pdo->query("SELECT name FROM sqlite_master 
WHERE type IN ('table','view') AND name NOT LIKE 'sqlite_%'
UNION ALL 
SELECT name FROM sqlite_temp_master 
WHERE type IN ('table','view') 
ORDER BY 1")->fetchAll(PDO::FETCH_ASSOC));